#链接到数据库
from pymysql import Connection

conn =Connection(
    host="localhost",
    port=3306,
    user="root",
    password="12345678"
)

# print(conn.get_server_info())
# 获取游标对象
cursor = conn.cursor()
# 选择数据库
conn.select_db("lsl_shop")
# 执行非查询sql
# cursor.execute("create table test_01(id int)")
# 执行查询sql
cursor.execute("select * from users")
result=cursor.fetchall()
for r in result:
    print(r)
#关闭链接
conn.close()